package com.baway.router

import android.content.Context
import com.alibaba.android.arouter.facade.Postcard
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.facade.service.DegradeService
import com.bawei.lib_base.RoutePath

/**
 * Author: Jason Zhang
 * Date: 2025/8/19
 * Desc: 全局降级策略（处理路由跳转中页面找不见的场景）
 */

@Route(path = RoutePath.PATH_GLOBAL_DEGRADE)
class GlobalDegradeService: DegradeService {

    private lateinit var mContent: Context

    override fun init(context: Context?) {
        context?.let {
            mContent = it
        }
    }

    override fun onLost(context: Context?, postcard: Postcard?) {
        postcard?.group = RoutePath.GROUP_EMPTY
        postcard?.path = RoutePath.PATH_EMPTY_PAGE
        postcard?.navigation()
    }


}